package com.hsy.order.base.ui.adapter

import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup

/**
 * 轮播适配器
 * Created on 2017/12/4.
 *
 * @author Yang
 */
class BannerAdapter(private val viewList: List<View>) : PagerAdapter() {

    override fun isViewFromObject(arg0: View, arg1: Any) = arg0 === arg1

    override fun getCount() = viewList.size

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
        container.removeView(viewList[position])
    }

    override fun getItemPosition(`object`: Any) = super.getItemPosition(`object`)

    override fun getPageTitle(position: Int) = "title"

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        container.addView(viewList[position])
        return viewList[position]
    }
}